package com.itcast.demo;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 消息生产者
 * @author   Shanks
 * @data     2018年10月27日 下午3:16:25
 * @version  V1.1
 */
@RestController
public class QueueController {
	
	@Autowired
	private JmsMessagingTemplate template;

	@RequestMapping("/send")
	public void send(String text) {
		template.convertAndSend("itcast", text);
	}
	
	@RequestMapping("/sendmap")
	public void sendMap() {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("mobile", "1388888888");
		map.put("signName", "品优购");
		map.put("templateCode", "SMS_149385652");
		map.put("templateParam", "{\"name\":\"Eric\"}");
		
		
		template.convertAndSend("sms_queue", map);
	}
}
